home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / mathematica / tex-mma.tar_z / tex-mma / addBBoxpro < prev    next >
Text File  |  1991-02-13  |  860b  |  40 lines

  1. #! /bin/sh
  2. # Filter to extract aspect ratio of Mathematica graphics and apply addBBoxproawk
  3.  
  4. # 2/1/1991 Dan Dill dan@chme.bu.edu
  5. # Based on scheme developed by Cameron Smith cameron@midd.bitnet
  6.  
  7. # addBBoxpro height fontsize
  8.  
  9. # Developed with gawk.  Should also work with latest awk
  10. awk=gawk
  11.  
  12. cmd=addBBoxpro
  13.  
  14. if [ $# -lt 2 ]
  15. then
  16. echo Usage: $cmd height fontsize
  17. echo Adjust height and fontsize of Mathematica graphics.
  18. echo See the $cmd shell script for details
  19. exit 1
  20. fi
  21.  
  22. height=$1
  23. fontsize=$2
  24. tmpname="texmmatmp"
  25.  
  26. # Abort cleanup
  27. trap 'rm /tmp/$tmpname.$$.ps; exit' 2
  28.  
  29. # Save the graphic in a temp file
  30. cat >/tmp/$tmpname.$$.ps
  31.  
  32. # Get aspect ratio
  33. aspratio=`$awk '/AspectRatio/&&flag==0 {print $2; flag=1}' /tmp/$tmpname.$$.ps`
  34.  
  35. # Filter the file
  36. cat /tmp/$tmpname.$$.ps | $awk -f addBBoxpro.awk $height $fontsize $aspratio
  37.  
  38. # Cleanup
  39. rm /tmp/$tmpname.$$.ps
  40.